import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop008_销售管理支付记录"

firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu2(firefox,'销售管理','支付记录')
rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\order1.txt' #拼接文件路径
orderNo=readFile(filePath) #读取文件中的订单编号

# firefox.find_element_by_xpath('//a[text()="%s"]/../following-sibling::td[5]'%orderNo)
firefox.find_element_by_xpath('//a[text()="%s"]/..'%orderNo).click()


s=firefox.find_element_by_xpath("//body").text
l="订单 "+orderNo+".*"+"\("
r="\)"
order_State=reGetString(s,l,r)
print(order_State) #order_State 是实际值
yuqi="订单完成"  #这是预期值
#检查点
if yuqi==order_State:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()